<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>公告信息修改</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="../../layui/css/layui.css" media="all">
    <script src="../../layui/layui.js" charset="utf-8"></script>
    <script src="../../jquery/jquery.min.js" charset="utf-8"></script>
    <script>
        $(function(){
            layui.use(['form', 'layedit', 'laydate'], function(){
                var form = layui.form
                        ,layer = layui.layer
                        ,layedit = layui.layedit
                        ,laydate = layui.laydate,
                        $ = layui.$;
                //监听提交
                form.on('submit(demo)', function (data) {
                    var datas=data.field; //以json格式接收表单中所有的数据
                    var action=data.form.action;
                    $.ajax({
                        url:action,
                        data:datas,
                        type:"POST",
                        dataType:"json",
                        success:function(flag){
                            debugger;
                            if (flag==true) {
                                layer.msg('公告信息修改成功!',{icon: 1,time:3000}, function(){
                                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                    parent.layer.close(index); //再执行关闭                        //刷新父页面
                                    parent.location.reload();
                                });
                            } else{
                                layer.msg('修改失败！');
                            }
                        },
                        error:function(error){
                            console.log(error);
                        }
                    });
                    return false;
                });

            });
        })
    </script>


</head>
<body>
<form class="layui-form layui-form-pane"  action="/announce/updateAnnounceInfo" style="margin:auto; width:82%;" method="post" >
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 10px;">
        <legend style="text-align:center;" ><h2>公告信息修改</h2></legend>
    </fieldset>
    <input id="aId" name="aId" type="hidden" value="${announce.aId}">
    <div class="layui-form-item" style="text-align: left">

        <label class="layui-form-label">公告标题：</label>
        <div class="layui-input-block">
            <input type="text" name="aName"  autocomplete="off" value="${announce.aName}" class="layui-input" lay-verify="required">
        </div>
        <br>
        <label class="layui-form-label">公告内容：</label>
        <div class="layui-input-block">
            <input maxlength="100"
                   onkeyup="this.value=this.value.substring(0, 100)"
                   placeholder="最多可输入100字" class="layui-textarea note"name="aDesc" value="${announce.aDesc}" >
        </div>
    </div>

        <div class="layui-form-item" style="text-align:center">
        <div class="layui-input-block">
            <button class="layui-btn layui-btn-normal layui-btn-lg" lay-submit=""  lay-filter="demo">提交</button>&nbsp;&nbsp;&nbsp;&nbsp;
        </div>
    </div>
</form>

<div style="height:250px"></div>

</body>
</html>
